﻿@model  Commonmenu
@{
    ViewBag.Title = "修改微信公众号菜单";
    var parentMenuList = ViewData["mainMenu"] as List<Commonmenu>;
}
@using (Html.BeginForm("UpdateCommonMenu", "WeChatMenu", FormMethod.Post, new { @area = "HANSWeChat", @class = "form-horizontal form-label-left js-form-submit", @novalidate = "", enctype = "multipart/form-data", id = "fileupload" }))
{
<div class="x_panel">
    <!--beginHead-->
    <div class="x_title">
        <h2>修改微信公众号菜单 <small>HANS</small></h2>
        <ul class="nav navbar-right panel_toolbox">
            <li>
                <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
            </li>
        </ul>
        <div class="clearfix"></div>
    </div>
    <!--endHead-->
    <div class="x_content">
        <!--beginForm-->
        @Html.AntiForgeryToken()
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    菜单标题<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Menuname, new { @class = "form-control col-md-7 col-xs-12" })
                </div>
                @Html.ValidationMessageFor(i => i.Menuname, null, new { @class = "text-danger" })
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    菜单Key<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Menukey, new { @class = "form-control col-md-7 col-xs-12" })
                </div>
                @*@Html.ValidationMessageFor(i => i.Menukey, null, new { @class = "text-danger" })*@
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    菜单类型<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.HiddenFor(i => i.Menutype)
                    <select class="form-control js-select-type" id="type">
                        <option value="" selected>父菜单</option>
                        @foreach (var item in Enum.GetNames(typeof(HANS_WeChat.Base.WeChatMenuType)))
                        {
                            <option value="@item">@item</option>
                        }
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12">
                    父菜单<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.HiddenFor(i => i.Parent_id)
                    <select class="form-control js-select-parent_id" id="parent_id">
                        <option  value=""selected>请选择</option>
                        @foreach (var item in parentMenuList)
                        {
                            <option value="@item.Id">@item.Menuname</option>
                        }
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    菜单排序<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Menuorder, new { @class = "form-control col-md-7 col-xs-12", @type = "number", @min = "0", @max = "100" })
                </div>
                @Html.ValidationMessageFor(i => i.Menuorder, null, new { @class = "text-danger" })
            </div>
            <div class="ln_solid"></div><!--一条横线-->
            <div class="form-group">
                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                    <button type="submit" class="btn btn-success">保存</button>
                    <a href="@HttpContext.Current.Request.UrlReferrer" class="btn btn-default">取消</a>
                </div>
            </div>
      
    </div>
</div>

<div class="x_panel">
    <!--beginHead-->
    <div class="x_title">
        <h2>微信公众号菜单<span class="required" style="color:red">(副项，请针对菜单Type填写副项！！！)</span> <small>HANS</small></h2>
        <ul class="nav navbar-right panel_toolbox">
            <li>
                <a class="collapse-link"><i class="fa fa fa-chevron-down"></i></a>
            </li>
        </ul>
        <div class="clearfix"></div>
    </div>
    <!--endHead-->
    <div class="x_content" style="display:none;">
        <div class="form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                Url<span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                @Html.TextBoxFor(i => i.Url, new { @class = "form-control col-md-7 col-xs-12" })
            </div>
            @Html.ValidationMessageFor(i => i.Url, null, new { @class = "text-danger" })
        </div>
        <div class="form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                Media_id<span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                @Html.TextBoxFor(i => i.Media_id, new { @class = "form-control col-md-7 col-xs-12", @placeholder = "view_limited类型只支持图文Media_id" })
            </div>
            @Html.ValidationMessageFor(i => i.Media_id, null, new { @class = "text-danger" })
        </div>
        <div class="form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                Appid<span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                @Html.TextBoxFor(i => i.Appid, new { @class = "form-control col-md-7 col-xs-12" })
            </div>
            @Html.ValidationMessageFor(i => i.Appid, null, new { @class = "text-danger" })
        </div>
        <div class="form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                Pagepath<span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                @Html.TextBoxFor(i => i.Pagepath, new { @class = "form-control col-md-7 col-xs-12" })
            </div>
            @Html.ValidationMessageFor(i => i.Pagepath, null, new { @class = "text-danger" })
        </div>
    </div>
</div>
 }
<!--endForm-->
@section Scripts{
    <script type="text/javascript">
        $(function () {
            changeSelect('#type', '@Model.Menutype');
            changeSelect('#parent_id','@Model.Parent_id');
        });
        var changeStringmenuType = { selectClass: ".js-select-type", selectValString: "#Menutype" };
        $('.js-select-type').change(changeStringmenuType, SetChangeSelectString);//菜单类型更改赋值
        var changStringParentmenu = { selectClass: ".js-select-parent_id", selectValString: "#Parent_id" };
        $('.js-select-parent_id').change(changStringParentmenu, SetChangeSelectString);//父菜单类型更改赋值
    </script>
}

